﻿using System;
using System.Linq.Expressions;

namespace MVVMFramework.ViewModel
{
    public class NotNullOrEmptyValidator : PropertyValidatorBase
    {
        public NotNullOrEmptyValidator(Expression<Func<object>> property, string message)
            : base(property, message)
        {
        }

        public override bool IsValid
        {
            get
            {
                string value = Convert.ToString(PropertyCompiled());
                return !string.IsNullOrEmpty(value);
            }
        }

        public override string ShortMessage
        {
            get
            {
                return "Cannot be empty";
            }
        }
    }
}
